let Utils = require('./../utils/utils');
const LoggerService = require('./../services/logger');
const LoggerDao = require('./../dao/logger');

const loggerService = new LoggerService(new LoggerDao());
const operateLog = function (req, res, next) {
  let urls = req.originalUrl.split('/');
  loggerService.insert({
    id: Utils.generateUUID(),
    module: urls[2],
    action: urls[3]
  }).then(_ => {
    next();
  });
};
module.exports = operateLog;